package edu.neu.swc.skynet.filter;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * <h1>配置登录请i去转发规则</h1>
 */
@Configuration
public class RouterLocatorConfig {

    /**
     * <h2>使用代码定义路由规则，在网关层面拦截下登录和注册接口</h2>
     */
    @Bean
    public RouteLocator loginRouteLocator(RouteLocatorBuilder builder){
        return builder.routes()
                .route(
                        "sky-net-authority",
                        r -> r.path(
                                "/wangY/sky-net/login",
                                "/wangY/sky-net/register"
                        ).uri("http://localhost:9001/")
                ).build();
    }

}